package service;

import dao.RouteDao;
import entity.Route;

import java.util.List;

public class RouteService {
    private RouteDao routeDao = new RouteDao();
    public int addRoute(Route route){
        return routeDao.add(route);
    }

    /**
     * 获取所有的旅游路线
     */
    public List<Route> getAll(){
        String sql = "select * from `route` where status=1";
        return routeDao.query(sql);
    }

    /**
     * 获取指定id的Route记录
     */
    public Route getRouteById(int id){
        String sql = "select `title`,`price` from `route` where `id`=?";
        return routeDao.query(sql, id).get(0);
    }
}
